home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / arts / mcoputils.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  2.7 KB  |  98 lines

  1.     /*
  2.  
  3.     Copyright (C) 2000 Stefan Westerfeld
  4.                        stefan@space.twc.de
  5.  
  6.     This library is free software; you can redistribute it and/or
  7.     modify it under the terms of the GNU Library General Public
  8.     License as published by the Free Software Foundation; either
  9.     version 2 of the License, or (at your option) any later version.
  10.   
  11.     This library is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.     Library General Public License for more details.
  15.    
  16.     You should have received a copy of the GNU Library General Public License
  17.     along with this library; see the file COPYING.LIB.  If not, write to
  18.     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19.     Boston, MA 02111-1307, USA.
  20.  
  21.     */
  22.  
  23. /*
  24.  * BC - Status (2002-03-08): MCOPUtils
  25.  *
  26.  * Collection class for all kinds of utility functions. BC, since never
  27.  * instanciated.
  28.  */
  29.  
  30. #ifndef MCOPUTILS_H
  31. #define MCOPUTILS_H
  32.  
  33. #include <string>
  34. #include <vector>
  35.  
  36. #include "arts_export.h"
  37.  
  38. namespace Arts {
  39.  
  40. class ARTS_EXPORT MCOPUtils {
  41. public:
  42.     /**
  43.      * Returns the full pathname to a file in the mcop directory which
  44.      * is called "name". It will also care that no other characters than
  45.      * A-Z,a-z,0-9,-,_ occur.
  46.      * 
  47.      * The result is something like /tmp/mcop-<username>/name, the directory
  48.      * will be created when necessary.
  49.      */
  50.     static std::string createFilePath(std::string name);
  51.  
  52.     /**
  53.      * Returns the fully qualified hostname, such as "www.kde.org" (of course
  54.      * this may fail due to misconfiguration).
  55.      *
  56.      * The result is "localhost" if nothing at all can be found out.
  57.      */
  58.     static std::string getFullHostname();
  59.  
  60.     /**
  61.      * Returns configuration values from .mcoprc
  62.      */
  63.     static std::string readConfigEntry(const std::string& key,
  64.                                         const std::string& defaultValue = "");
  65.  
  66.     /**
  67.      * Makes an interface ID from string - if the given string is already
  68.      * known, the returned IID will be the one returned last time. If not,
  69.      * a new IID is generated
  70.      */
  71.     static unsigned long makeIID(const std::string& interfaceName);
  72.  
  73.     /**
  74.      * Returns the directories for the trader to look into
  75.      */
  76.     static const std::vector<std::string> *traderPath();
  77.  
  78.     /**
  79.      * Returns the directories from where extensions can be loaded
  80.      */
  81.     static const std::vector<std::string> *extensionPath();
  82.  
  83.     /**
  84.      * Returns the full path of the ~/.mcop directory
  85.      */
  86.     static std::string mcopDirectory();
  87.  
  88.     /**
  89.      * Tokenization of a key = value1, "value 2", "value III" line into the key
  90.      * and the values.
  91.      */
  92.     static bool tokenize(const std::string& line, std::string& key,
  93.                          std::vector<std::string>& values);
  94. };
  95.  
  96. }
  97. #endif /* MCOPUTILS_H */
  98.